<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<table width="600px">
<tr bgcolor="#EEEEEE" align="center" height="20px">
    <th width="150px">Group Name</th>
    <th width="450px">Group Members</th>
</tr>
<%  //connect to database and set the emp_id to the session
    String query="select * from group1";
    //String query1="select name from group_member where group_name='"+"beta"+"'";
    Connection db_conn = null;
    Statement statement = null;
    PreparedStatement pstmt;
    ResultSet rs=null;
    ResultSet rs1=null;
    try{
        Class.forName("com.mysql.jdbc.Driver");
        String url= "jdbc:mysql://localhost:3306/db";
        db_conn = DriverManager.getConnection( url,"root", "root" );
        statement = db_conn.createStatement();
        rs=statement.executeQuery(query);
        while (rs.next()){ // parse the results
            String a=rs.getString("group1.group_name");
            //System.out.println("******\n"+rs.isLast());
            out.println("<tr><td>"+a+" * "+rs.isLast()+"</td>");
            
            //line below this has a problem don't know what
            
            rs1=statement.executeQuery("select * from group_member where group_name='"+a+"'");
             out.println("<td>");
            //while(rs1.next()){
             rs1.next();
            System.out.println("#");
            out.print(rs1.getString("group_member.name")+" ");
            //}
            //  out.print("<jsp:include page='"+"group_member.jsp"+"'"+">");
            //   out.println("<jsp:param name='"+"pid"+"'"+" value='"+a+"'"+"/>");      
           //   out.println("</jsp:include>");
            out.println(" *</td>");
            out.println("</tr>");
            
            }
            db_conn.close();

            } catch(SQLException e){
                out.println(" Fuck1 "+e+" </td>");
            out.println("</tr>");
            e.printStackTrace();
  
        } catch(ClassNotFoundException e){
            out.println(" Fuck2 </td>");
            out.println("</tr>");
            e.printStackTrace();
            out.println(e);
        }
%>

</table>